Voice switching for voice communication on computers

ABSTRACT

A voice communication end device performs quality checks to determine whether acoustic echo cancellation would be ineffective, such as due to noise or clock drift or discontinuities between incoming and outgoing voice channels. In the case where echo cancellation would prove ineffective, the device falls back on a tri-state voice switching operation that includes a bi-direction state in which both channels are on in full duplex operation, which provides a smoother transition switching between active channels. The tri-state voice switching supports both voluntary transitions where the active user voluntarily stops to yield the active channel, and forced transitions where the active user is forcedly interrupted by the other user speaking more loudly.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. patent application Ser. No.12/032,589, filed Feb. 15, 2008, which is hereby incorporated byreference in its entirety.

BACKGROUND

Acoustic echo is a common phenomenon occurring in two-way voicecommunication when open speakers are used. For example, FIG. 1illustrates one end 100 of a typical two-way communication system. Theother end is exactly the same. In such a system, the far-end voice isplayed through a loud speaker 160 and captured by the microphone 110 inthe system and sent back to the far end. The far-end user then hears hisor her own voice with a certain delay.

There are a number of known approaches to reducing acoustic echo intwo-way communication systems. However, these known approaches faceparticular problems when applied to voice communication systems usingpersonal computers, such as internet telephony and voice chatapplications on personal computers.

1. Acoustic Echo Cancellation

Acoustic Echo Cancellation (AEC) is a digital signal processingtechnology which is used to remove the acoustic echo from a speakerphone in two-way (full duplex) or multi-way communication systems, suchas traditional telephone or modem internet audio conversationapplications.

With reference again to the example near end 100 of a typical two-waycommunication system illustrated in FIG. 1, an Acoustic EchoCancellation is used to remove echo of the far end user's voice. Theexample near end 100 includes a capture stream path and a render streampath for the audio data in the two directions. The far end of thetwo-way communication system is exactly the same. In the capture streampath in the figure, an analog to digital (A/D) converter 120 convertsthe analog sound captured by microphone 110 to digital audio samplescontinuously at a sampling rate (fs_(mic)). The digital audio samplesare saved in capture buffer 130 sample by sample. The samples areretrieved from the capture buffer in frame increments (herein denoted as“mic[n]”). Frame here means a number (n) of digital audio samples.Finally, samples in mic[n] are processed, including encoding via a voiceencoder 170 and sent to the other end.

In the render stream path, the system receives the encoded voice signalfrom the other end, decodes audio samples via voice decoder 180 andplaces the audio samples into a render buffer 140 in periodic frameincrements (labeled “spk[n]” in the figure). Then the digital to analog(D/A) converter 150 reads audio samples from the render buffer sample bysample and converts them to an analog signal continuously at a samplingrate, fs_(spk). Finally, the analog signal is played by speaker 160.

In systems such as that depicted by FIG. 1, the near end user's voice iscaptured by the microphone 110 and sent to the other end. At the sametime, the far end user's voice is transmitted through the network to thenear end, and played through the speaker 160 or headphone. In this way,both users can hear each other and two-way communication is established.But, a problem occurs if a speaker is used instead of a headphone toplay the other end's voice. For example, if the near end user uses aspeaker as shown in FIG. 1, his microphone captures not only his voicebut also an echo of the sound played from the speaker (labeled as“echo(t)”). In this case, the mic[n] signal that is sent to the far enduser includes an echo of the far end user's voice. As the result, thefar end user would hear a delayed echo of his or her voice, which islikely to cause annoyance and provide a poor user experience to thatuser.

Practically, the echo echo(t) can be represented by speaker signalspk(t) convolved by a linear response g(t) (assuming the room can beapproximately modeled as a finite duration linear plant) as per thefollowing equation:

echo(t)=spk(t)*g(t)=∫₀ ^(T) ^(e) g(τ)·spk(t−τ)dτ

where * means convolution, T_(e) is the echo length or filter length ofthe room response.

In order to remove the echo for the remote user, AEC 210 is added in thesystem as shown in FIG. 2. When a frame of samples in the mic[n] signalis retrieved from the capture buffer 130, they are sent to the AEC 210.At the same time, when a frame of samples in the spk[n] signal is sentto the render buffer 140, they are also sent to the AEC 210. The AEC 210uses the spk[n] signal from the far end to predict the echo in thecaptured mic[n] signal. Then, the AEC 210 subtracts the predicted echofrom the mic[n] signal. This difference or residual is the clear voicesignal (voice[n]), which is theoretically echo free and very close tothe near end user's voice (voice(t)).

FIG. 3 depicts an implementation of the AEC 210 based on an adaptivefilter 310. The AEC 210 takes two inputs, the mic[n] and spk[n] signals.It uses the spk[n] signal to predict the mic[n] signal. The predictionresidual (difference of the actual mic[n] signal from the predictionbased on spk[n]) is the voice[n] signal, which will be output as echofree voice and sent to the far end.

The actual room response (that is represented as g(t) in the aboveconvolution equation) usually varies with time, such as due to change inposition of the microphone 110 or speaker 160, body movement of the nearend user, and even room temperature. The room response therefore cannotbe pre-determined, and must be calculated adaptively at running time.The AEC 210 commonly is based on adaptive filters such as Least MeanSquare (LMS) adaptive filters 310, which can adaptively model thevarying room response.

The nature of adaptive filtering requires that the microphone signal andthe reference or speaker signal must be accurately aligned. On personalcomputers, timestamps are typically used to align the microphone andspeaker signals. However, in practice, these timestamps are noisy andsometimes can be very wrong. One reason for this is that major operatingsystems, such as Microsoft Windows XP operating system, support numerousdifferent audio devices. It is quite common that some audio device andits driver cannot provide accurate timestamps. In such case, the signalsare often out of alignment, and the AEC fails to properly cancel echoes.

2. Voice Switching

Voice switching is a method used for half-duplex two-way communication.A typical example of such communication system has two signal channels:an incoming channel that receives the voice signal coming from thefar-end, and an outgoing channel that sends the near end voice signal tothe far-end. In a person-to-person scenario, the far-end may be anotherend user device. Alternatively, in a conference or multi-user scenario,the far end may be a server that hosts the multiple user conference.Based on voice activity being present at the two ends, the channels areselectively turned on or off. In other words, whenever there is voiceactivity in one channel, the other channel is turned off. By selectivelyswitching off either incoming or outgoing channels based on voiceactivity in this way, the echo path is broken, which effectively removesacoustic echoes. The drawback of voice switching, however, is that itprovides only half-duplex mode of communication.

Voice switching is commonly used on low-end desktop phones in speakerphone mode. A basic voice switching algorithm simply compares thestrength of near-end and far-end voices and turns on the communicationchannel for the end with the stronger voice. It is relatively simple tocompare voice activity on a standalone or dedicated phone device,because the microphone and speaker gains are known. During double talkscenarios (i.e., in which both ends are talking simultaneously), it iseasy to estimate echo strength and thus easy to compare which voice isstronger. However, for voice communication applications on personalcomputers, any microphone or speaker may be connected to the computer,and the gains could be adjusted by the users at any time. Thiscomplicates the ability to estimate the echo strength, and therefore tocompare the voice strength on the channels to accurately determine whichchannel should be switched on.

SUMMARY

The following Detailed Description concerns various improvements tovoice switching techniques for avoiding or reducing acoustic echo intwo-way communications applications and systems. These improved voiceswitching techniques can be used as a fall back solution for avoiding orreducing acoustic echo in cases that acoustic echo cancellation fails,such as where incoming and outgoing stream alignment is not possible dueto inaccurate or erratic timestamps.

According to a first aspect, the improved voice switching technique usestri-state transitions to provide smooth switching between active (i.e.,switched on) voice channels. By contrast, conventional voice switchingused for speaker phone mode on a typical standalone desktop phones makea simple binary decision switching between incoming voice channel andoutgoing voice channel states. The improved voice switching techniqueincludes transitions with an additional third or bi-directional state,in which both incoming and outgoing channels are on. This additionalbi-direction state ensures a smooth channel switching without losing theinitial syllable or word spoken at voice onset.

According to a further aspect, the improved voice switching techniquehas two types of conditions to transition between active channel states,which include voluntary and forced transitions. In a voluntarytransition, the active user voluntarily gives up the active channel.This occurs when there is a segment of silence on the active voicechannel that is longer than a threshold. In such case, the voiceswitching technique enters the bi-direction state. If the user on theother end begins to speak, then the active channel switches to thatuser. In this way, the user on the active channel has voluntarilypermitted the other user to “take over” having the active channel. Aforced transition occurs when the active user if forcedly interrupted bythe user at the other end. For example, the user on the other endinterrupts by speaking sufficiently louder than the user on the activechannel.

This Summary is provided to introduce a selection of concepts in asimplified form that is further described below in the DetailedDescription. This summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used as an aid in determining the scope of the claimed subjectmatter. Additional features and advantages of the invention will be madeapparent from the following detailed description of embodiments thatproceeds with reference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating one end of a typical two-waycommunication system in the prior art.

FIG. 2 is a block diagram of the two-way communication system of FIG. 1with audio echo cancellation.

FIG. 3 is a block diagram of an implementation of audio echocancellation based on an adaptive filter.

FIG. 4 is a block diagram illustrating one end of a two-waycommunication system utilizing voice switching.

FIG. 5 is a state diagram illustrating a tri-state transitions of thevoice switching method used in the communication system of FIG. 4.

FIG. 6 is a block diagram of a generalized operating environment inconjunction with which various described embodiments may be implemented.

DETAILED DESCRIPTION

The following detailed description concerns various techniques andsystems for voice switching in two-way communication systems. Thedescribed voice switching techniques use tri-state transitions andvoluntary and forced transition conditions to provide smoother switchingof active channels. The voice switching techniques are described withparticular application in personal computer based telephony and voicechat applications, where the voice switching technique may be employedas a fall back measure in the case that acoustic echo cancellation failsto work properly (such as, due to inaccurate or noisy timestampspreventing alignment of microphone and speaker signals). However, thevoice switching techniques can be applied more broadly to other two-wayvoice communication systems and scenarios.

The various techniques and tools described herein may be usedindependently. Some of the techniques and tools may be used incombination. Various techniques are described below with reference toflowcharts of processing acts. The various processing acts shown in theflowcharts may be consolidated into fewer acts or separated into moreacts. For the sake of simplicity, the relation of acts shown in aparticular flowchart to acts described elsewhere is often not shown. Inmany cases, the acts in a flowchart can be reordered.

I. Overview of Voice Switching Two-Way Communication System

FIG. 4 illustrates one end of a two-way communication system thatincludes voice switching with tri-state transitions along with voluntaryand forced transition conditions, as described more fully below. Theother end is typically, but not necessarily identical. Each end may be acommunication device, such as a phone device or a personal computer witha telephony or voice chat application, or a game console, among otherexamples. In some implementations, the far end can be a communicationserver, such as a voice conferencing host server.

The illustrated near end 100 includes a capture stream path and a renderstream path for the audio data in the two directions. In the capturestream path in the figure, an analog to digital (A/D) converter 120converts the analog sound captured by microphone 110 to digital audiosamples continuously at a sampling rate (fs_(mic)). The digital audiosamples are saved in capture buffer 130 sample by sample. The samplesare retrieved from the capture buffer in frame increments (hereindenoted as “mic[n]”). Frame here means a number (n) of digital audiosamples. Finally, samples in mic[n] are processed, including encodingvia a voice encoder 170 and sent to the other end.

In the render stream path, the system receives the encoded voice signalfrom the other end, decodes audio samples via voice decoder 180 andplaces the audio samples into a render buffer 140 in periodic frameincrements (labeled “spk[n]” in the figure). Then the digital to analog(D/A) converter 150 reads audio samples from the render buffer sample bysample and converts them to an analog signal continuously at a samplingrate, fs_(spk). Finally, the analog signal is played by speaker 160.

The illustrated communication system end device includes tri-state voiceswitching 410 to avoid or reduce acoustic echo (echo(t)) of the far endspeaker's voice being picked up by the microphone 110 and sent back tothe far end.

II. AEC Quality Check

In general use, the two-way communication system provides full duplextwo-way communication using acoustic echo cancellation 210, which isimplemented as illustrated in FIG. 2 and discussed above. The tri-statevoice switching 410 is enabled as a fall back mechanism under operatingconditions where the acoustic echo cancellation 210 would fail to workproperly to cancel echo or would introduce unacceptable noise ordistortion effects. Accordingly, the two-way communication end 400performs one or more quality checks to determine if the communicationquality is sufficient for acoustic echo cancellation to work properly.The quality check can utilize multiple quality metrics, such as thelevel of noise or echo, clock drift rate (relative drift betweenmicrophone and speaker channel clocks), and detection of glitches ordiscontinuities in microphone and speaker channel clocks.

One example implementation of the two-way communication system performstwo types of quality checks to assess potential effectiveness ofacoustic echo cancellation, which are checking for timestamp errors andaudio glitches. As for the timestamp errors, a timestamp marks the timewhen the first sample of a data frame is captured or rendered, such asat the A/D converter 120 (FIG. 4) and D/A converter 150, respectively.Ideally, the timestamp should match the device's stated sampling rateperfectly. For example, assuming the two-way communication end device400 has a sampling rate of 16000 Hz and a 10 millisecond data frame isused by the device for capturing and rendering audio signals, then anaudio data frame has 160 samples. This means that for each captured orrendered frame containing 160 samples, the timestamp of the first sampleof consecutive frames should increase by exactly 10 milliseconds. Inother words, the frame length calculated from the timestamps ofconsecutive frames should be exactly 10 milliseconds.

In practice, there may be errors in the timestamps, as discussed morefully in the background. This can result in the frame length calculatedfrom timestamps being more or less than expected length (e.g., 10milliseconds in this example implementation). If the long term averageof the calculated frame length varies from the expected frame length,then the difference is called the timestamp drift. The drift divided bythe nominal frame length is called the timestamp drift rate. A non-zerotimestamp drift rate signifies the communication end device's samplingrate is off from its claimed or nominal rate. Finally, for each audiodata frame, the difference of the respective frame's length from thelong term average frame length is termed the “timestamp noise.”

A second type of quality check is for audio glitches. Audio glitchesmean discontinuities in audio stream. For audio data capture (e.g., themicrophone 110 and A/D converter 120), audio glitches may occur when theapplication is not able to retrieve samples in the capture buffer intime so that the capture buffer becomes over full, which can result inlost audio capture samples. For the audio data rendering (e.g., fromloudspeaker 160 and D/A converter), audio glitches can mean theapplication does not fill the render buffer quickly enough, so the audiorendering device has no data to play.

The quality check for effective audio echo cancellation in the exampleimplementation includes checking for timestamp noise level of both therender and capture devices, the relative timestamp drift between captureand render devices, and how often audio glitches occur. The exampleimplementation determines that the quality is not sufficient foreffective audio echo cancellation if the render device timestamp noiseis greater than 0.005 seconds, or if the capture device timestamp noiseis greater than 0.002 seconds, or if the absolute relative drift ratebetween capture and render devices is greater than 0.3%, or if audioglitches occur more frequently than once per second.

In one example implementation, each end of the two-way communicationsystem performs the quality check at preset intervals after thecommunication session (e.g., voice call or conference) is initiated. Theinitial quality check is done at about 4 seconds after the communicationsession starts, and is then repeated at 10 second intervals. If allquality checks produce the result that a sufficiently high quality foracoustic echo cancellation exists, then the two-way communication systemend device may stop quality checks after 100 seconds. Initially, thetwo-way communication system end device provides full duplex usingacoustic echo cancellation, and continues with that operation so long asthe quality checks have the sufficiently high quality result. However,if a quality check fails, then the two-way communication system endswitches over to tri-state voice switching 410 operation. In alternativeimplementations, the two-way communication system may continue qualitychecks throughout the communication session and switch to full duplexcommunication with acoustic echo cancellation when sufficiently highquality is detected, and otherwise switch over to the tri-state voiceswitching 410. The quality checking is performed independently for eachend device, which may result in one end device having sufficiently highquality to operate in full duplex with acoustic echo cancellation whilethe other device has insufficient quality and falls back to thetri-state voice switching.

III. Detailed Explanation of Tri-State Transitions for Voice Switching

The tri-state voice switching 410 has a three state operationillustrated by the state diagram in FIG. 5. These include an incomingstate 520, outgoing state 530, and bi-direction state 540. The incomingand outgoing states are referred to as active states. The channel thatis switched on in the actives states is referred to as being the activechannel. The user who occupies the active channel is referred to as theactive user. In the incoming state, the speaker channel is switched onand is the active channel. The far end user therefore is the activeuser. In the outgoing state, the microphone channel is switched on andis the active channel. The near end user is the active user in theoutgoing state.

The third state is called the bi-direction state 540, and has bothmicrophone and speaker channels switched on. When both ends are quiet,the system enters the bi-direction state and monitors the voice activityon both ends. If voice activity is detected on one end, the systemleaves the bi-direction state and transitions to one of the activestates based on which end is active. The bi-direction state operates tohelp ensure smooth channel switching without losing an initial syllableor word upon voice activity onset of the next active user.

The tri-state switching 410 of the communication end device 400 allowsfor two different types of conditions to trigger switching from oneactive channel to the other: voluntary and forced transitions.

One condition (the voluntary transition condition) is when the activeuser voluntarily gives up the active channel by ceasing voice activity.The system detects a silence segment in the active user's voice activityis longer than a threshold delay, and enters the bi-direction state 540.Thereafter, when the other end user begins talking, the active channelis then switched to that user.

The other condition (forced transition) is when the active user isforcedly interrupted by the user on the other end. The forced transitionhappens when the user on the other end wants to interrupt the activeuser, and does so by speaking sufficiently louder than the active user.Because it is difficult to accurately determine which end has strongervoice activity during such “double-talk” scenarios (e.g., due tovariance in speaker and microphone gain), this “sufficiently louder”means louder enough that the voice activity on the inactive channel isreally louder than the voice on the active channel to account for mostmicrophone-speaker configurations. In other words, the condition uses athreshold ratio of inactive to active channel voice energy chosen toaccount for gain variance of most microphone-speaker configurations.

In more detail, the incoming state 520 is one in which the microphonechannel (i.e., the mic[n] or outgoing channel) is completely muted, andthe speaker channel (i.e., the spk[n] or incoming channel from the otherend) is on. That is to say, the other end user is the active user andthe speaker channel is the active channel. The system is in the incomingstate when the other end's user is talking.

The outgoing state 530 has the microphone channel on, while the speakerchannel is muted or attenuated. This means the near end user andmicrophone channel are active. The system is in the outgoing state whenthe near end user is talking.

On the other hand, both channels are on in the bi-direction state 540.The bi-direction state is the state where both near-end and far-endusers are quiet. This is the initial state of the system.

During operation, the tri-state voice switching 410 makes transitions511-516 between the bi-direction, incoming, and outgoing states. Asindicated above, the tri-state switching 410 begins in the bi-directionstate, where both microphone and speaker channels are switched on.

From the bi-direction state 540, the tri-state switching 410 can maketransitions 512, 514 to the outgoing or incoming states. The tri-stateswitching 410 remains in the bi-direction state while both near-end andfar-end users are quiet. The transition 512 from the bi-direction stateto the outgoing state 530 is conditioned on detecting near-end voiceactivity for more than 50 milliseconds. On the other hand, thetransition 514 from the bi-direction state to the incoming state 520 isconditioned on detecting far-end voice activity for more than 20milliseconds.

After the transition 512 to the outgoing state 530 or the transition 514to the incoming state 520, the tri-state switching remains in theoutgoing or incoming state while voice activity solely from the near-endor far-end user continues, respectively. In these states, the near-endor far-end user can voluntarily relinquish exclusive use of the voicechannel by ceasing to talk. If this occurs, the tri-state switchingreturns to the bi-direction state via transitions 511, 513. Thevoluntary transition 511 from the incoming state 520 to the bi-directionstate 540 is conditioned on the far-end user being quiet for more than100 milliseconds. The condition for the voluntary transition 513 fromthe outgoing state 530 to the bi-direction state 540 is that the nearend user is quiet for more than 800 milliseconds.

On the other hand, the tri-state switching 510 also can make forced orvoluntary transitions 515, 516 directly between the incoming state 520and the outgoing state 530. The transition 515 from the outgoing stateto the incoming state can occur under either a voluntary condition or aforced condition. The voluntary condition occurs if the near-end user isquiet for more than 400 milliseconds and far-end voice activity isdetected for more than 50 milliseconds. The forced condition is that thefar-end voice energy peak is stronger than the near-end voice energypeak by more than 25 times stronger for more than 400 milliseconds andthe far-end voice activity is detected for more than 100 milliseconds.

The transition 516 from the incoming state directly to the outgoingstate also can occur under a forced condition. The forced condition isthat the near-end voice activity is four times stronger than the far-endvoice (measured by energy peak) for more than 100 milliseconds, and thenear-end voice activity is detected for more than 100 milliseconds.

IV. Computing Environment

The two-way communication end device 400 shown in FIG. 4 can beimplemented as dedicated or special purpose communication device (e.g.,a desktop phone, in which the acoustic echo cancellation quality checkand tri-state switching 410 is implemented using a digital signalprocessor programmed by firmware or software to operate as illustratedin FIG. 5.

Alternatively, the two-way communication system can be implemented usinga general purpose computer with suitable programming to perform thequality check and tri-state switching operation using a digital signalprocessor on a sound card, or even the central processing unit of thecomputer to perform the digital audio signal processing. For example,the two-way communication system can be a laptop or desktop computerwith voice communication software (e.g., a telephony, voice conferencingor voice chat application software). Alternatively, the two-waycommunication system can be a mobile computing device that providesvoice communication. FIG. 6 illustrates a generalized example of asuitable computing environment 600 in which the two-way communicationsystem 400 with tri-state voice switching 410 may be implemented on suchgeneral purpose computers. The computing environment 600 is not intendedto suggest any limitation as to scope of use or functionality, asdescribed embodiments may be implemented in diverse general-purpose orspecial-purpose computing environments, as well as dedicated audioprocessing equipment.

With reference to FIG. 6, the computing environment 600 includes atleast one processing unit 610 and memory 620. In FIG. 6, this most basicconfiguration 630 is included within a dashed line. The processing unit610 executes computer-executable instructions and may be a real or avirtual processor. In a multi-processing system, multiple processingunits execute computer-executable instructions to increase processingpower. The processing unit also can comprise a central processing unitand co-processors, and/or dedicated or special purpose processing units(e.g., an audio processor or digital signal processor, such as on asound card). The memory 620 may be volatile memory (e.g., registers,cache, RAM), non-volatile memory (e.g., ROM, EEPROM, flash memory), orsome combination of the two. The memory 620 stores software 680implementing one or more audio processing techniques and/or systemsaccording to one or more of the described embodiments.

A computing environment may have additional features. For example, thecomputing environment 600 includes storage 640, one or more inputdevices 650, one or more output devices 660, and one or morecommunication connections 670. An interconnection mechanism (not shown)such as a bus, controller, or network interconnects the components ofthe computing environment 600. Typically, operating system software (notshown) provides an operating environment for software executing in thecomputing environment 600 and coordinates activities of the componentsof the computing environment 600.

The storage 640 may be removable or non-removable, and includes magneticdisks, magnetic tapes or cassettes, CDs, DVDs, or any other medium whichcan be used to store information and which can be accessed within thecomputing environment 600. The storage 640 stores instructions for thesoftware 680.

The input device(s) 650 may be a touch input device such as a keyboard,mouse, pen, touchscreen or trackball, a voice input device, a scanningdevice, or another device that provides input to the computingenvironment 600. For audio or video, the input device(s) 650 may be amicrophone, sound card, video card, TV tuner card, or similar devicethat accepts audio or video input in analog or digital form, or a CD orDVD that reads audio or video samples into the computing environment.The output device(s) 660 may be a display, printer, speaker,CD/DVD-writer, network adapter, or another device that provides outputfrom the computing environment 600.

The communication connection(s) 670 enable communication over acommunication medium to one or more other computing entities. Thecommunication medium conveys information such as computer-executableinstructions, audio or video information, or other data in a datasignal. A modulated data signal is a signal that has one or more of itscharacteristics set or changed in such a manner as to encode informationin the signal. By way of example, and not limitation, communicationmedia include wired or wireless techniques implemented with anelectrical, optical, RF, infrared, acoustic, or other carrier.

Embodiments can be described in the general context of computer-readablemedia. Computer-readable media are any available media that can beaccessed within a computing environment. By way of example, and notlimitation, with the computing environment 600, computer-readable mediainclude memory 620, storage 640, and combinations of any of the above.

Embodiments can be described in the general context ofcomputer-executable instructions, such as those included in programmodules, being executed in a computing environment on a target real orvirtual processor. Generally, program modules include routines,programs, libraries, objects, classes, components, data structures, etc.that perform particular tasks or implement particular data types. Thefunctionality of the program modules may be combined or split betweenprogram modules as desired in various embodiments. Computer-executableinstructions for program modules may be executed within a local ordistributed computing environment.

For the sake of presentation, the detailed description uses terms like“determine,” “receive,” and “perform” to describe computer operations ina computing environment. These terms are high-level abstractions foroperations performed by a computer, and should not be confused with actsperformed by a human being. The actual computer operations correspondingto these terms vary depending on implementation.

In view of the many possible embodiments to which the principles of ourinvention may be applied, we claim as our invention all such embodimentsas may come within the scope and spirit of the following claims andequivalents thereto.

We claim:
 1. A computer-readable media storing instructions thereon forexecuting a method of preventing acoustic echo in a two-way voicecommunication end device, the method comprising: upon starting acommunication session with another communication end device, operatingin a full duplex voice communication with acoustic echo cancellationmode; determining whether the voice communication with the othercommunication end device has sufficient quality for effective acousticecho cancellation; and in the event that the voice communication isdetermined to lack sufficient quality, operating in a tri-state voiceswitching mode; wherein operating in the tri-state voice switching modecomprises: operating in an outgoing state when voice activity isdetected on an outgoing channel; operating in incoming state when voiceactivity is detected on an incoming channel; operating in abi-directional state when voice activity ceases for over a thresholdperiod of time while in the incoming or outgoing states; from theincoming state, forcing a transition to the outgoing state when there isvoice activity on both the incoming and outgoing channels, but a firstenergy level associated with the volume of the voice activity onoutgoing channel exceeds a second energy level of the voice activity onthe incoming channel.
 2. The computer-readable media of claim 1, furtherincluding performing at least one quality check comprising performing aplurality of quality check at intervals over a starting period of thecommunication session.
 3. The computer-readable media of claim 1 whereinsaid operating in a tri-state voice switching mode further comprises:upon detecting stronger volume of voice activity in the not activechannel when in the incoming or outgoing state, switching betweenincoming and outgoing states.
 4. The computer-readable media of claim 3wherein said detecting stronger volume of voice activity comprisesdetecting the voice energy peak associated with the volume of voiceactivity of the not active channel is more than a threshold multiplestronger for a threshold period than the active channel.
 5. Thecomputer-readable media of claim 1, wherein the forcing of thetransition occurs only when the first energy level associated with avolume of voice activity exceeds the second energy level associated witha volume of voice activity by the predetermined amount for apredetermined period of time.
 6. A computer-readable media storinginstructions thereon for executing a method of preventing acoustic echoin a two-way voice communication end device, the method comprising:detecting voice activity in incoming and outgoing voice channels of thetwo-way voice communication end device; determining in which of aplurality of voice switching states to operate based on said voiceactivity detecting, the voice switching states comprising at least abi-directional state in which both the incoming and outgoing voicechannels are both switched on effecting full duplex communication, anincoming channel active state in which the incoming channel only isswitched on to be active, and an outgoing channel active state in whichthe outgoing channel is switched on to be active; and forcing atransition from the incoming channel active state to the outgoingchannel active state or vice versa based on a comparison between energylevels associated with the volume of voice activity on the incoming andoutgoing voice channels.
 7. The computer-readable media of claim 6,wherein the forcing of the transition occurs only when the first energylevel associated with a volume of voice activity exceeds the secondenergy level associated with a volume of voice activity by thepredetermined amount for a predetermined period of time.
 8. Thecomputer-readable media of claim 6, wherein said determining in which ofthe voice switching states to operate comprises: upon detectingsufficiently louder voice activity on the non-active channel for longerthan a threshold duration, making a direct transition between incomingand outgoing channel active states.
 9. The computer-readable media ofclaim 6, wherein detecting sufficiently louder voice activity comprisesdetecting voice activity on the non-active channel more than asufficiency factor louder than the voice activity on the active channel.10. The computer-readable media of claim 6, wherein the bi-directionalstate is entered into when voice activity ceases for over a thresholdperiod of time.
 11. The computer-readable media of claim 6, wherein themethod further comprises: in the event that the voice communication isdetermined to lack sufficient quality, operating in a tri-state voiceswitching mode, which comprises: operating in an outgoing state whenvoice activity is detected on an outgoing channel; operating in incomingstate when voice activity is detected on an incoming channel; operatingin a bi-directional state when voice activity ceases for over athreshold period of time while in the incoming or outgoing states; fromthe incoming state, forcing the transition to the outgoing state whenthere is voice activity on both the incoming and outgoing channels, buta first energy level associated with the volume of the voice activity onoutgoing channel exceeds a second energy level of the voice activity onthe incoming channel by a predetermined amount.
 12. Thecomputer-readable media of claim 6, wherein the method further comprisesperforming at least one quality check at time intervals over a period ofa communication session during which the voice activity is detected. 13.A two-way voice communication end device comprising: an incoming speakerchannel for receiving an incoming voice signal; an outgoing microphonechannel for capturing an outgoing voice signal; a tri-state voice switchselectively switching between multiple voice states comprising at leasta bi-direction state providing full duplex communication via theincoming and outgoing channels, and incoming and outgoing active statesin which a respective one of the incoming and outgoing voice channels isactive; and wherein the tri-state voice switch forces a switchingbetween the incoming voice channel and the outgoing voice channel basedon an energy level associated with the volume of voice activitycomparison between the two channels when both incoming and outgoingvoice signals occur simultaneously.
 14. The two-way voice communicationend device of claim 13, wherein the tri-state voice switch effectstransitions between incoming and outgoing active states under avoluntary transition condition in which voice activity ceases for longerthan a silence segment duration on the incoming and outgoing voicechannels by first switching to the bi-direction state before switchingto one of the incoming and outgoing active states when voice activity isagain present on either the incoming or outgoing voice channels.
 15. Thetwo-way voice communication end device of claim 13, wherein thetri-state voice switch effects transitions between incoming and outgoingactive states under a forced transition condition in which voiceactivity on a non-active one of the incoming and outgoing voice channelsis sufficiently louder than voice activity on the active one of theincoming and outgoing voice channels by directly switching betweenincoming and outgoing active states.
 16. The two-way voice communicationend device of claim 15, wherein the force transition condition is thatthe voice activity on the non-active channel is more than a sufficiencyfactor louder than the voice activity on the active channel.
 17. Thetwo-way voice communication end device of claim 16, wherein the forcetransition condition occurs only when the comparison of the energylevels associated with a volume of voice activity results in adifference that is sustained for a predetermined period of time.
 18. Thetwo-way voice communication end device of claim 13, wherein the forcingof the switching occurs when the energy level associated with a volumeof voice activity comparison indicates a difference in energy levelsthat is sustained for a predetermined period of time.